package light.head.model.inv;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Formula;

/**
 * 订单明细
 * @author yuleidian
 *
 */
@Entity
@Table
public class InvOrderItem implements Serializable{
	private static final long serialVersionUID = 5732027964255025110L;
	
	private Integer code;				// 流水号
	private Integer oic;				// 订单编号
	private Integer cc;					// 商品编号
	private Integer count;				// 数量
	private Double price;				// 价格
	private Boolean deleted = false;	// 是否删除
	
	private String cname;				// 商品名称
	private Byte snc;					// 序列号状态
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Integer getOic() {
		return oic;
	}
	@Column
	public Integer getCc() {
		return cc;
	}
	@Column
	public Integer getCount() {
		return count;
	}
	@Column
	public Double getPrice() {
		return price;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Formula("(SELECT c.name FROM InvCommodityInfo c WHERE c.code IN (SELECT ci.cc FROM InvCommodityItem ci WHERE ci.code = cc))")
	public String getCname() {
		return cname;
	}
	@Formula("(SELECT c.snc FROM InvCommodityItem c WHERE c.code = cc)")
	public Byte getSnc() {
		return snc;
	}
	
	
	
	
	
	
	public void setSnc(Byte snc) {
		this.snc = snc;
	}
	public void setCname(String cname) {
		this.cname = cname;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setOic(Integer oic) {
		this.oic = oic;
	}
	public void setCc(Integer cc) {
		this.cc = cc;
	}
	public void setCount(Integer count) {
		this.count = count;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	
	
	
}
